<!DOCTYPE html>
<%@ page pageEncoding="UTF-8" %>
<%@taglib prefix="s" uri="/struts-tags" %>

<html lang="zh_CN">
<head>
    <meta charset="utf-8">
    <title>电子书</title>
    <link href="${contextPath}/css/bootstrap.css" rel="stylesheet">
    <link href="${contextPath}/css/bootstrap-responsive.css" rel="stylesheet">
</head>
<body>
<div class="container-fluid">
    <div class="row-fluid">
        <div class="span12">

            <div class="page-header">
                <h1>电子书同步</h1> <h6>新浪微博登录->授权访问金山快盘->订阅电子书->系统同步电子书到快盘</h6>
                <div style="float:right;position: absolute; right:150px;top:15px;">
                    <%-- struts2 标签使用ONGL表达式 --%>
                    <s:if test="#session._islogin">
   	                    <a href="${contextPath}/books/logout.action">注销</a>
                    </s:if>
                   <s:else>
	                    <a href="${contextPath}/books/login.action">登录</a>
                   </s:else>
                   <s:property value="#session._login_userid"/>
                </div>                
            </div>
            <s:actionmessage  cssClass="alert alert-error"/>
            <table class="table table-striped">
                <tr>
                    <th>序号</th>
                    <th style="display:none">名称</th>
                    <th>名称</th>
                    <th>发布时间</th>
                    <th>操作</th>
                </tr>
                <s:iterator value="books" var="book">
                <tr>
                    <td>${id}</td>
                    <td style="display:none">${name}</td>
                    <td>${display_name}</td>
                    <td>${publish_date}</td>
                    <td>
                        <div class="btn-group">
                            <s:if test="userBooks.containsKey(#book.id.toString())">
	                            <a href="javascript:alert('亲，这个功能还没实现！');" 
	                                   class="btn btn-primary"><i class="icon icon-refresh"></i> 同步</a>
	                            <a href="${contextPath}/books/unsubscription.action?id=<s:property value="userBooks[#book.id.toString()]"/>" 
	                                   class="btn btn-inverse"><i class="icon-white icon-trash"></i> 退订</a>
                            </s:if>
                            <s:else>
                                <a href="${contextPath}/books/subscription.action?id=${id}" class="btn btn-success"><i class="icon icon-eye-open"></i> 订阅</a>
                            </s:else>
				            <s:if test="user.type == 2">
                                <a href="${contextPath}/books/${id}/deleteConfirm" class="btn btn-danger"><i class="icon icon-trash"></i> 删除</a>
                            </s:if>
                        </div>
                   </td>
                </tr>
                </s:iterator>
            </table>
            <s:if test="user.type == 2">
                <a href="books/new" class="btn btn-primary"><i class="icon icon-file"></i> 添加新电子书</a>
            </s:if>
        </div><!--/row-->
    </div><!--/span-->
</div><!--/row-->
</body>
</html>
    